<template>
    <div>
        <ul class="history">
            <li class="item">
                <p class="title">历史订单</p>
                <p class="data">{{history.History_num?history.History_num:0}}</p>
            </li>
            <li class="item">
                <p class="title">历史金额</p>
                <p class="data">{{history.History_money?history.History_money:0}}元</p>
            </li>
        </ul>
        <section class="login_message">
            <input type="text" v-model="date" readonly @click="openPicker">
        </section>
        <template>
            <mt-datetime-picker
                ref="picker"
                type="date"
                @confirm="handleConfirm"
                v-model="date">
            </mt-datetime-picker>
        </template>
        <div class="st">
            <div class="order_item" v-for="(item,index) of history.list" :key="index">
                <mt-cell :title="'订单编号:'+item.order_no"></mt-cell>
                <mt-cell>+<span class="money">{{item.floor_price}}</span>元</mt-cell>
            </div>
        </div>
    </div>
</template>
<script>
import {statistics} from '../api'
export default {
    data() {
        return {
            history:{},
            date:((new Date).getFullYear())+'-'+((new Date).getMonth()+1)+'-'+((new Date).getDate())
        }
    },
    created(){
        this.Statistics();
    },
    methods:{
        openPicker() {
        this.$refs.picker.open();
        },
        handleConfirm(val){
            console.log(val.getFullYear()+'-'+(val.getMonth()+1)+'-'+val.getDate());
            this.date = (val.getFullYear())+'-'+(val.getMonth()+1)+'-'+(val.getDate())
            // console.log(this.date);
            this.Statistics();
        },
        Statistics(){
            const data={
                token:this.$store.getters.token,
                user_id:this.$store.getters.userInfo.id,
                time:this.date
            }
            statistics(data).then(res=>{
                console.log(res)
                this.history = res.data;
            })
        }
    }
}
</script>
<style scoped>
    .history{
        display: flex;
        list-style-type: none;
        justify-content: space-around;
        align-items: center;
    }
    .item{
        width: 50%;
        text-align: center;
        border-bottom: 1px solid #666;
        height: 4rem;
        color: blue;
        line-height: 2rem;
    }
    .item:first-child{
        border-right: 1px solid #666;
        color: red;
    }
    .title{
        font-weight: bolder;
    }
    .data{
        color: #666;
        font-size: 1.5rem;
    }
    .st{
        height: Calc(100vh - 11.5rem)
    }
    .st a{
        height: 2rem;
        line-height: 2rem;
        /* border-bottom: 1px solid #ccc; */
        margin-left: 1rem;
    }
    .st >>> .mint-cell-wrapper{
        font-size: 1rem;
    }
    .order_item{
        padding: 0.4rem 0;
        border-bottom: 1px solid #999;
    }
    .money{
        color:red;
        font-weight: bolder;
        font-size: 1.2rem;
    }
    .login_message >>> .mint-datetime-action {
    line-height: 3rem !important;
    font-size: 1rem !important;
}
    .login_message >>> .picker-toolbar{
        height: 3rem;
    }
    .login_message >>> .picker-slot {
        font-size: 1rem;
    }
.picker-slot {
    font-size: 1rem;
}
.picker-center-highlight:before, .picker-center-highlight:after{
    content: '';
    position: absolute;
    height: 0.1rem;
    width: 100%;
    background-color: #eaeaea;
    display: block;
    z-index: 15;
    -webkit-transform: scaleY(0.5);
    transform: scaleY(0.5);
}
</style>